package com.tianji.api.client.promotion;

import com.tianji.api.client.promotion.fallback.PromotionClientFallback;
import com.tianji.api.dto.promotion.CouponDiscountDTO;
import com.tianji.api.dto.trade.OrderCouponDTO;
import com.tianji.api.dto.trade.OrderCourseDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

@FeignClient(value = "promotion-service", fallbackFactory = PromotionClientFallback.class)
public interface PromotionClient {
    /**
     * 查询可用优惠券方案
     *
     * @param courses
     * @return
     */
    @PostMapping("/user-coupons/available")
    List<CouponDiscountDTO> findDiscountSolution(@RequestBody List<OrderCourseDTO> courses);

    /**
     * 查询对应优惠方案
     *
     * @param orderCouponDTO
     * @return
     */
    @PostMapping("/user-coupons/discount")
    CouponDiscountDTO getDiscountDetail(@RequestBody OrderCouponDTO orderCouponDTO);

    /**
     * 优惠券核销
     * @param userCouponIds
     */
    @PutMapping("/use")
    void useUserCoupon(@RequestBody List<Long> userCouponIds);
}
